package com.eschool.beans;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.eschool.beans.datamodels.StudentDataModel;
import com.eschool.model.Student;
import com.eschool.service.StudentService;
import com.eschool.service.impl.StudentServiceImpl;

@ManagedBean(name="viewStudentsBean")
@ViewScoped
public class ViewStudentsBean {
	
	private List<Student> students;
	private Student selectedStudent;
	private StudentService service;
    private StudentDataModel model;

	public ViewStudentsBean() {		
		service = new StudentServiceImpl();
		model = new StudentDataModel();
		students = service.getAllStudents();
	}
	
	public List<Student> getStudents() {
		return students;
	}

	public void setStudents(List<Student> students) {
		this.students = students;
	}	

	public Student getSelectedStudent() {
		return selectedStudent;
	}

	public void setSelectedStudent(Student selectedStudent) {
		this.selectedStudent = selectedStudent;
	}
	
	public StudentDataModel getModel() {
		return model;
	}

	public void setModel(StudentDataModel model) {
		this.model = model;
	}
}
